﻿// /*
//  * @Author: wanyiming
//  * @Date:2024-05-21-20:42
//  * @Description:
//  */

using Code.Core.CoreBaseClass;
using Code.GameLogic.GameCamera;
using Code.GameLogic.Map.Controller;
using Code.GameLogic.Monster.Controller;
using QFramework;

namespace Code.GameLogic.Common.Event
{
    public class GlobalEvent : BaseController
    {
        private CameraController _cameraController;
        private MonsterManager _monsterManager;
        private MapManager _mapManager;

        
        private void Start()
        {
            _cameraController = GetComment<CameraController>();
            _monsterManager = GetComment<MonsterManager>();
            _mapManager = GetComment<MapManager>();
            this.RegisterEvent<CameraLockAtEs>(CameraLockAt);
            this.RegisterEvent<CreateMonsterFlashPointEs>(CreateMonsterFlashPoint);
            this.RegisterEvent<PlaceBlockShowEs>(SwitchPlaceBlock);
        }


        
        private void CameraLockAt(CameraLockAtEs cameraLockAtEs)
        {
            _cameraController.LockAtGo(cameraLockAtEs.TargetGo);
        }

        private void CreateMonsterFlashPoint(CreateMonsterFlashPointEs createMonsterFlashPointEs)
        {
            _monsterManager.CreateMonsterFlashPoint(createMonsterFlashPointEs.BlockGo);
        }


        private void SwitchPlaceBlock(PlaceBlockShowEs placeBlockShowEs)
        {
            _mapManager.SwitchPlaceBlock(placeBlockShowEs.ShowType);
        }



        public override IArchitecture GetArchitecture()
        {
            return MainApp.Interface;
        }
    }

    
    

}